package com.luweijie.pojo;

import jdk.nashorn.internal.ir.annotations.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.concurrent.Executor;

/**
 * 多线程
 * */
public class test2 {

    @Resource(name = "pushThreadPoolExecutor")
    public Executor executor;

    public  void get(){
        ArrayList<Object> objects = new ArrayList<>();
        executor.execute(
                new Runnable() {
                    @Override
                    public void run() {
                        long startTime = System.currentTimeMillis();
                        for (int i =0 ; i <10000000; i++) {
                            objects.add(i);
                        }
                        long endTime = System.currentTimeMillis();
                       long a=  endTime-startTime;
                        System.out.println("endTime = " + a);
                    }
                }
        );

    }

    public static void main(String[] args) {

        test2 test2 = new test2();
        test2.get();
    }
}
